package com.spongebob.util;

import org.springframework.stereotype.Component;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class TimeChange {



    public String getTime(String date) throws ParseException {

        DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        DateFormat outputFormat = new SimpleDateFormat("KK:mm a");
        String format = outputFormat.format(inputFormat.parse(date));

      return format;
    }
    public String getTime(Date date){
    SimpleDateFormat dateFormat = new SimpleDateFormat("KK:mm a");

       return dateFormat.format(date);

    }

}
